<?php
/*********************************************************************************
 * SugarCRM is a customer relationship management program developed by
 * SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
 * 
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Affero General Public License version 3 as published by the
 * Free Software Foundation with the addition of the following permission added
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
$dictionary['edanz_Deliverables'] = array(
	'table'=>'edanz_deliverables',
	'audited'=>true,
	'fields'=>array (
		'date_due' => array (
			'required' => true,
			'name' => 'date_due',
			'vname' => 'LBL_DATE_DUE',
			'type' => 'datetimecombo',
			'massupdate' => '1',
			'comments' => '',
			'help' => 'When is this deliverable due for the client?',
			'importable' => 'false',
			'duplicate_merge' => 'disabled',
			'duplicate_merge_dom_value' => '0',
			'audited' => true,
			'reportable' => true,
			'size' => '20',
			'dbType' => 'datetime',
			'group' => 'date_due',
    		'enable_range_search' => true,
    		'options' => 'date_range_search_dom',
		),
		'speed' => array (
			'required' => true,
			'name' => 'speed',
			'vname' => 'LBL_SPEED',
			'type' => 'enum',
			'massupdate' => '1',
			'default' => 'standard',
			'comments' => '',
			'help' => '',
			'importable' => 'false',
			'duplicate_merge' => 'disabled',
			'duplicate_merge_dom_value' => '0',
			'audited' => true,
			'reportable' => true,
			'len' => 100,
			'size' => '20',
			'options' => 'speed_list',
			'dependency' => false,
		),
		'r2_job_id' => array (
			'name' => 'r2_job_id',
			'vname' => 'LBL_R2_JOB_ID',
			'type' => 'id',
			'audited' => false,
		),
		'origin_system' => array (
			'name' => 'origin_system',
			'vname' => 'LBL_ORIGIN_SYSTEM',
			'type' => 'enum',
			'len' => '100',
			'options' => 'origin_systems',
			'audited' => true,
		),
		'service' => array (
			'required' => true,
			'name' => 'service',
			'vname' => 'LBL_SERVICE',
			'type' => 'enum',
			'massupdate' => '1',
			'help' => 'What type of service are we delivering?',
			'importable' => 'false',
			'duplicate_merge' => 'disabled',
			'audited' => true,
			'reportable' => true,
			'len' => 100,
			'size' => '20',
			'options' => 'service_type_list'
		),
		'fast_fail' => array (
			'required' => false,
			'name' => 'fast_fail',
			'vname' => 'LBL_FAST_FAIL',
			'type' => 'bool',
			'default'=>'1',
			'massupdate' => '1',
			'importable' => 'false',
			'duplicate_merge' => 'disabled',
			'audited' => false,
			'reportable' => true,
			'len' => 100,
			'size' => '20',
		),
		'manuscript_pages' => array (
			'required' => false,
			'name' => 'manuscript_pages',
			'vname' => 'LBL_MANUSCRIPT_PAGES',
			'type' => 'int',
			'massupdate' => '1',
			'importable' => 'false',
			'duplicate_merge' => 'disabled',
			'audited' => true,
			'reportable' => true,
			'len' => 100,
			'size' => '20',
		),
		'workload' => array (
			'name' => 'workload',
			'vname' => 'LBL_WORKLOAD',
			'type' => 'decimal',
			'dbType' => 'double',
			'audited' => false,
		),
		'job_name' => array (
			'required' => true,
			'name' => 'job_name',
			'type' => 'relate',
			'id_name' => 'job_id',
			'module' => 'edanz_Jobs',
			'vname' => 'LBL_JOB_NAME',
			'source' => 'non-db',
		),
		'job_id' => array (
			'name' => 'job_id',
			'type' => 'id',
			'vname' => 'LBL_LIST_RELATED_TO',
		),
		'job_password' => array (
			'name' => 'job_password',
			'type' => 'varchar',
			'vname' => 'LBL_JOB_PASSWORD',
			'source' => 'non-db',
			'audited' => false,
		),
		'security_group' => array (
		      'id' => 'security_group',
		      'name' => 'security_group',
		      'type' => 'enum',
		      'vname' => 'LBL_SECURITY_GROUP',		   
		      'options' => 'security_group_list',
		      'audited' => false,
		    ),
		'flagged' => array (
			  'name' => 'flagged',
			  'type'=>'bool',
			  'default' => " ",
			  'vname' => 'LBL_FLAGGED',
			  'source' => 'non-db',
			  'audited' => false,
		),
		'has_manager_check' => array (
                        'name'=>'has_manager_check',
                        'vname' => 'LBL_HAS_MANAGER_CHECK',
                        'type' => 'bool',
                        'default' => false,
                ),
		'tasks' => array (
			  'name' => 'tasks',
			  'vname' => 'LBL_TASKS',
			  'type' => 'link',
			  'relationship' => 'deliverable_tasks',
			  'source' => 'non-db',
			  'audited' => false,
		),
		'flags' => array (
			  'name' => 'flags',
			  'vname' => 'LBL_FLAGS',
			  'type' => 'link',
			  'relationship' => 'edanz_deliverables_edanz_flags',
			  'source' => 'non-db',
			  'audited' => false,
		),
        'feedback' => array (
                  'name' => 'feedback',
                  'vname' => 'LBL_FEEDBACK',
                  'type' => 'link',
                  'relationship' => 'deliverable_feedback',
                  'source' => 'non-db',
                  'audited' => false,
        ),
        'name'=>array(
			'name' => 'name',
			'vname' => 'LBL_NAME',
			'type' => 'varchar',
			'audited' => true,
			'required' => true,
			
		),
		'description'=>array(
			'name' => 'description',
			'vname' => 'LBL_DESCRIPTION',
			'type' => 'text',
			'audited' => true,
		),
        
	),
	'relationships'=>array (
		'deliverable_tasks' => array(
			'lhs_module' => 'edanz_Deliverables',
			'lhs_table' => 'edanz_deliverables',
			'lhs_key' => 'id',
			'rhs_module' => 'Tasks',
			'rhs_table' => 'tasks',
			'rhs_key' => 'deliverable_id',
			'relationship_type' => 'one-to-many',
        ),
        'deliverable_feedback' => array(
                'lhs_module' => 'edanz_Deliverables',
                'lhs_table' => 'edanz_deliverables',
                'lhs_key' => 'id',
                'rhs_module' => 'edanz_Feedback',
                'rhs_table' => 'edanz_feedback',
                'rhs_key' => 'deliverable_id',
                'relationship_type' => 'one-to-many',
        ),
	),
	'optimistic_locking'=>true,
);

// Security Suite Groups
global $beanList;
if (isset($beanList['SecurityGroups'])) {
	$dictionary["edanz_Deliverables"]["fields"]["securitygroups_edanz_deliverables"] = array (
	  'name' => 'securitygroups_edanz_deliverables',
	  'type' => 'link',
	  'relationship' => 'securitygroups_edanz_deliverables',
	  'source' => 'non-db',
	  'vname' => 'LBL_SECURITYGROUPS_SUBPANEL_TITLE',
	);
	$dictionary["edanz_Deliverables"]["relationships"]["securitygroups_edanz_deliverables"] = array (
		'lhs_module' => 'SecurityGroups',
		'lhs_table' => 'securitygroups',
		'lhs_key' => 'id',
		'rhs_module' => 'edanz_Deliverables',
		'rhs_table' => 'edanz_deliverables',
		'rhs_key' => 'id',
		'join_table' => 'securitygroups_records',
		'join_key_lhs' => 'securitygroup_id',
		'join_key_rhs' => 'record_id',
		'relationship_type' => 'many-to-many',
		'relationship_role_column' => 'module',
		'relationship_role_column_value' => 'edanz_Deliverables',
	);
}


	$dictionary["edanz_Deliverables"]["fields"]["edanz_deliverables_edanz_authorpreferences"] = array (
	  'name' => 'edanz_deliverables_edanz_authorpreferences',
	  'type' => 'link',
	  'relationship' => 'edanz_deliverables_edanz_authorpreferences',
	  'source' => 'non-db',
	  'vname' => 'LBL_AUTHORPREFERENCES_SUBPANEL_TITLE',
	);
	$dictionary["edanz_Deliverables"]["fields"]["edanz_deliverables_edanz_documents"] = array (
	  'name' => 'edanz_deliverables_edanz_documents',
	  'type' => 'link',
	  'relationship' => 'edanz_deliverables_edanz_documents',
	  'source' => 'non-db',
	  'vname' => 'LBL_AUTHORPREFERENCES_SUBPANEL_TITLE',
	);
	$dictionary["edanz_Deliverables"]["fields"]["edanz_deliverables_edanz_flags"] = array (
	  'name' => 'edanz_deliverables_edanz_flags',
	  'type' => 'link',
	  'relationship' => 'edanz_deliverables_edanz_flags',
	  'source' => 'non-db',
	  'vname' => 'LBL_FLAG_SUBPANEL_TITLE',
	);
	$dictionary["edanz_Deliverables"]["fields"]["edanz_deliverables_edanz_communications"] = array (
	  'name' => 'edanz_deliverables_edanz_communications',
	  'type' => 'link',
	  'relationship' => 'edanz_deliverables_edanz_communications',
	  'source' => 'non-db',
	  'vname' => 'LBL_AUTHORPREFERENCES_SUBPANEL_TITLE',
	);
	$dictionary["edanz_Deliverables"]["fields"]["edanz_deliverables_edanz_fees"] = array (
	  'name' => 'edanz_deliverables_edanz_fees',
	  'type' => 'link',
	  'relationship' => 'edanz_deliverables_edanz_fees',
	  'source' => 'non-db',
	  'vname' => 'LBL_FEES_SUBPANEL_TITLE',
	);


if (!class_exists('VardefManager')){
        require_once('include/SugarObjects/VardefManager.php');
}
VardefManager::createVardef('edanz_Deliverables','edanz_Deliverables', array('basic'));
